/*
 * Scaffold Application Framework
 *
 * Copyright (c) 2010 Sii Sp. z o.o. All rights reserved.
 */
package com.rstrulak.constant;

import org.hibernate.criterion.MatchMode;

/**
 * Used to create multi field filter. It holds name of domain object filtered
 * field, {@link FilterComparisonType}, value and {@link MatchMode}.
 * 
 * @author Wojciech Kochman
 * @version 1.0
 * @param <T> type of filtered value
 */
public class FilterField<T> {
    /**
     * The value.
     */
    private T value;
    /**
     * Domain object's field name.
     */
    private String fieldName;
    /**
     * The comparison type.
     */
    private FilterComparisonType comparisonType;
    /**
     * The mact mode.
     */
    private MatchMode matchMode;

    /**
     * Short Constructor. Sets {@link MatchMode} to {@link MatchMode#START}
     * 
     * @param value the value
     * @param fieldName the domain object's field name
     * @param comparisonType the {@link FilterComparisonType}
     */
    public FilterField(T value, String fieldName, FilterComparisonType comparisonType) {
        this.value = value;
        this.fieldName = fieldName;
        this.comparisonType = comparisonType;
        this.matchMode = MatchMode.START;
    }

    /**
     * Full Constructor.
     * 
     * @param value the value
     * @param fieldName the domain object's field name
     * @param comparisonType the {@link FilterComparisonType}
     * @param matchMode the {@link MatchMode}
     */
    public FilterField(T value, String fieldName, FilterComparisonType comparisonType, MatchMode matchMode) {
        this.value = value;
        this.fieldName = fieldName;
        this.comparisonType = comparisonType;
        this.matchMode = matchMode;
    }

    /**
     * Getter for value.
     * 
     * @return the value
     */
    public T getValue() {
        return value;
    }

    /**
     * Setter for value.
     * 
     * @param value the value to set
     */
    public void setValue(T value) {
        this.value = value;
    }

    /**
     * Getter for fieldName.
     * 
     * @return the fieldName
     */
    public String getFieldName() {
        return fieldName;
    }

    /**
     * Setter for fieldName.
     * 
     * @param fieldName the fieldName to set
     */
    public void setFieldName(String fieldName) {
        this.fieldName = fieldName;
    }

    /**
     * Getter for comparisonType.
     * 
     * @return the comparisonType
     */
    public FilterComparisonType getComparisonType() {
        return comparisonType;
    }

    /**
     * Setter for comparisonType.
     * 
     * @param comparisonType the comparisonType to set
     */
    public void setComparisonType(FilterComparisonType comparisonType) {
        this.comparisonType = comparisonType;
    }

    /**
     * Getter for matchMode.
     * 
     * @return the matchMode
     */
    public MatchMode getMatchMode() {
        return matchMode;
    }

    /**
     * Setter for matchMode.
     * 
     * @param matchMode the matchMode to set
     */
    public void setMatchMode(MatchMode matchMode) {
        this.matchMode = matchMode;
    }

}
